<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <title>白月黑羽web教学：薪资统计</title>
</head>

<p id="source">p文本1
<!-- 注释1 -->
<span id='text1'>span文本1</span>
p文本
2
<span id='text2'>span文本2</span>
p文本
3
</p>

<script>
const source = document.querySelector("#source");

console.log(source.childNodes)

// 打印出获取子节点的类型
for (let node of source.childNodes)
  console.log(node.constructor.name)
</script>
</html>